package email

import (
	"gin-vue-admin/server/config"
	"gin-vue-admin/server/plugin/email/global"
	"gin-vue-admin/server/plugin/email/router"
	"github.com/gin-gonic/gin"
)

type EmailPlugin struct{}

func CreateEmailPlug(email config.Email) *EmailPlugin {
	global.GlobalConfig.To = email.To
	global.GlobalConfig.From = email.From
	global.GlobalConfig.Host = email.Host
	global.GlobalConfig.Secret = email.Secret
	global.GlobalConfig.Nickname = email.Nickname
	global.GlobalConfig.Port = email.Port
	global.GlobalConfig.IsSSL = email.IsSSL
	return &EmailPlugin{}
}
func (*EmailPlugin) Register(group *gin.RouterGroup) {
	router.GroupApp.InitEmailRouter(group)
}

func (*EmailPlugin) RouterPath() string {
	return "email"
}
